package com.ag.zlw.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ag.bean.TbExpertArea;
import com.ag.common.AgException;
import com.ag.common.IDUtil;
import com.ag.common.IIDService;
import com.ag.zlw.dao.TbExpertAreaDAO;
import com.ag.zlw.service.ExpertAreaService;

/**
 * 专家领域
 * 
 * @author 钟龙伟
 * 
 */

@Service("ExpertAreaService")
public class ExpertAreaServiceImpl implements ExpertAreaService {
	@Resource(name = "ZLWTbExpertAreaDAO")
	private TbExpertAreaDAO tbExpertAreaDAO;

	private String IDs;
	@Resource(name = "iDServiceImpl")
	private IIDService idservice;

	public void save(TbExpertArea ExpertArea) throws AgException {
		IDs = (String) idservice.findTablePK(IDUtil.TB_EXPERT_AREA);
		ExpertArea.setExpareaId(IDs);
		tbExpertAreaDAO.save(ExpertArea);
	}

	public List<TbExpertArea> findAll() {
		return tbExpertAreaDAO.findAll();
	}

	public void delete(TbExpertArea ExpertArea) {
		TbExpertArea tbExpertArea = tbExpertAreaDAO.findById(ExpertArea
				.getExpareaId());
		tbExpertArea.setA(IDUtil.DELETE);
		tbExpertAreaDAO.attachDirty(tbExpertArea);
	}

	public void modify(TbExpertArea ExpertArea) {
		tbExpertAreaDAO.attachDirty(ExpertArea);
	}
}
